<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title></title>
    <script src="jquery.js"></script>
    <script>
      let p = new Promise(function(resolve,reject){

      $.ajax({
        url: 'data/arr.txt',
        dataType: 'json',   //用json 解析数组
        success(arr){
          resolve(arr);
        },
        error(err){
          reject(err);
        }
      });
      });

      let p2 = new Promise(function(resolve,reject){

      $.ajax({
        url: 'data/json.txt',
        dataType: 'json',
        success(arr){
          resolve(arr);
        },
        error(err){
          reject(err);
        }
      });
      });

      Promise.all([
        p,p2
      ]).then(function(arr)
      {
        let [result1, result2] = arr;  //解构赋值
        alert('success ' + arr);
      },
      function(err){
        alert('one fail  at least' + err);
      });


    </script>
  </head>
  <body>

  </body>
</html>
